<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    // const p=new Promise(function(resolve, reject){
    //     resolve();
    //     // reject();
    // })
    //
    // p.then(()=>{console.log("ok")})

    function sendAjax(url){
        return new Promise((resolve,reject)=>{
            let xhr=new XMLHttpRequest();
            xhr.open("get",url);
            xhr.send();
            xhr.onload=()=>{
                if(xhr.response.indexOf("成功")){
                    resolve(xhr.response);
                }else{
                    reject();
                }
            }
        })
    }


</script>


</body>
</html>